
package keter.framework.model;

import java.util.List;

import keter.framework.model.base.CacheModel;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jfinal.aop.Before;
import com.jfinal.aop.Enhancer;
import com.jfinal.ext.plugin.tablebind.TableBind;
import com.jfinal.plugin.activerecord.tx.Tx;

/**
 * <p>Class       : keter.domain.CodeList
 * <p>Descdription: 类功能描述
 * @author  顾力行-gulx@neusoft.com
 * @version 1.0.0
 */
/*
    private String value;
    private String name;
    private String kind;
    private String kind_Name;
 */
@TableBind(tableName="codelist")
public class Codelist extends CacheModel<Codelist> {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = LoggerFactory.getLogger(Codelist.class);
	public static final Codelist dao = new Codelist();
	
    public static Codelist service = Enhancer.enhance(Codelist.class);

    public List<Codelist> findByKind(String kind) {
    	return findWithCache(kind,"select * from codelist where kind = ? order by id", wrap(kind));
    }
    
    public  boolean save() {
        this.setID();
    	return saveWithCache(getStr("kind"));
    }
    
    public  boolean update() {
    	return updateWithCache(getStr("kind"));
    }
    
    public  boolean delete() {
    	return deleteWithCache(getStr("kind"));
    }
    
    /**
     * 仅用于事务功能验证测试，无任何意义
     * @param cl1
     * @param cl2 
     * @author  gulx@neusoft.com
     * @date    2016年4月19日
     */
    @Deprecated
    @Before(Tx.class)
    public  void saveTx(Codelist cl1, Codelist cl2){
        cl1.save();  
        int i = 1/0;
        cl2.save();  
    }

	@Override
	protected void validate() {
		// TODO Auto-generated method stub	
	}
}
